<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /**
         * 数组
         */ 
        let nums = [3,12,67,8]
        // let a = nums[0]
        // let b = nums[1]
        // let c = nums[2]
        // let d = nums[3]
        
        let [a,b,c,d] = nums
        console.log(a,b,c,d)


        /**
         * 对象
         */ 
        let user = {
            age: 18,
            sex: 'female',
            name: 'tom'
        }

        // let name = user.name
        // let age = user.age
        // let sex = user.sex

        // let {name,age,sex} = user
        // console.log(name,age,sex)

        // let username = user.name
        let {name: username} = user 
        console.log(username)

        /**
         * 示例   result
         */ 
        // let res = {
        //     status: 200,
        //     msg: 'success',
        //     data: [
        //         {
        //             id: 1001,
        //             name: 'tom'
        //         },
        //         {
        //             id: 1002,
        //             name: 'jack'
        //         },
        //         {
        //             id: 1003,
        //             name: 'alice'
        //         }
        //     ]
        // }

        // let users = res.data
        // console.log(users)

        let {data: users} = {
            status: 200,
            msg: 'success',
            data: [
                {
                    id: 1001,
                    name: 'tom'
                },
                {
                    id: 1002,
                    name: 'jack'
                },
                {
                    id: 1003,
                    name: 'alice'
                }
            ]
        }
        console.log(users)

    </script>
</head>
<body>
    
</body>
</html>